
function myNew(ctor,...args){
  let obj = new Object()
  obj.__proto__ == ctor.prototype
  var ret = ctor.apply(obj, args);

  return typeof ret === 'object' ? ret : obj;
}

function Person(name,age) {
  this.name = name 
  this.age = age
}

const a = new Person('zhangsan',24)
console.log(a)

const b = myNew(Person,'zhangsan', 24)
console.log('b',b)
